package univ.uchiha.esiag.gon.accesser;

import java.util.Vector;

import univ.uchiha.esiag.gon.operation.Operation;

public class DataReactor {
	private DataReaderListener listener;
	private Vector<Operation> objs;
	public DataReactor() {
		objs = new Vector<Operation>();
	}
	public void setListener(DataReaderListener listener){
		this.listener = listener;
	}
	public void put(Operation obj){
		objs.add(obj);
		if(listener != null){
			listener.notification();	
		}
	}
	public Operation readData(){
		if(objs.size() <= 0)
			return null;
		return objs.remove(0);
	}
	public String getTopicName(){
		if(listener == null)
			return null;
		return listener.getTopicName();
	}
}
